import 'package:tender_flutter/page/common/model/upload_result_entity.dart';

uploadResultEntityFromJson(UploadResultEntity data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id'] is String
				? int.tryParse(json['id'])
				: json['id'].toInt();
	}
	if (json['name'] != null) {
		data.name = json['name'].toString();
	}
	if (json['path'] != null) {
		data.path = json['path'].toString();
	}
	if (json['mime'] != null) {
		data.mime = json['mime'].toString();
	}
	if (json['size'] != null) {
		data.size = json['size'] is String
				? int.tryParse(json['size'])
				: json['size'].toInt();
	}
	if (json['md5'] != null) {
		data.md5 = json['md5'].toString();
	}
	if (json['sha1'] != null) {
		data.sha1 = json['sha1'].toString();
	}
	if (json['createDate'] != null) {
		data.createDate = json['createDate'].toString();
	}
	if (json['url'] != null) {
		data.url = json['url'].toString();
	}
	return data;
}

Map<String, dynamic> uploadResultEntityToJson(UploadResultEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['path'] = entity.path;
	data['mime'] = entity.mime;
	data['size'] = entity.size;
	data['md5'] = entity.md5;
	data['sha1'] = entity.sha1;
	data['createDate'] = entity.createDate;
	data['url'] = entity.url;
	return data;
}